<?php
/**
 * PlatInfoController.class.php
 * 平台信息配置控制器
 * 
 * @author  王中艺 <wangzy_smile@qq.com>
 * @date    2017-05-28
 */

namespace Admin\Controller;

class PlatInfoController extends BaseController {

    /**
     * 获取VIP介绍信息
     * @return  text
     */
    function getVipIntro(){
        $intro  = D('PlatInfo')->getItem('VIP_INTRODUCT');
        $this->outOInfo(['info' => $intro]);
    }

    /**
     * 变更VIP介绍信息
     * @param   vip_intro
     * @return  boolean
     */
    function updateVipIntro(){
        $this->unEmptyParam(['vip_intro']);

        $vipIntro   = $this->request('vip_intro');
        $result     = D('PlatInfo')->updateItem('VIP_INTRODUCT', $vipIntro);
        if($result === false)
            $this->outOInfo(D('PlatInfo')->errMsg, 0);
        $this->outOInfo();
    }

    /**
     * 获取晨间家长必读
     * @return  $html
     */
    function getMorningParentWill(){
        $info   = D('PlatInfo')->getItem('MORNING_PARENT_WILL');
        $this->response(['info' => $info]);
    }

    /**
     * 更新晨间家长必读
     * @param   $info
     * @return  boolean
     */
    function updateMorningParentWill(){
        $client     = $this->unEmptyParam(['info']);
        $result     = D('PlatInfo')->updateItem('MORNING_PARENT_WILL', $client['info']);
        if($result === false)
            $this->response(D('PlatInfo')->errMsg, 0);
        $this->response();
    }

    /**
     * 获取晚间家长必读
     * @return  $html
     */
    function getEveningParentWill(){
        $info   = D('PlatInfo')->getItem('EVENING_PARENT_WILL');
        $this->response(['info' => $info]);
    }

    /**
     * 更新晚间家长必读
     * @param   $info
     * @return  boolean
     */
    function updateEveningParentWill(){
        $client     = $this->unEmptyParam(['info']);
        $result     = D('PlatInfo')->updateItem('EVENING_PARENT_WILL', $client['info']);
        if($result === false)
            $this->response(D('PlatInfo')->errMsg, 0);
        $this->response();
    }
}
